<?php
require_once __DIR__ . "/../fast_theme/base.php";

use fast\Controller;

/* JAside_History_Today on */
if ($this->options->JAside_History_Today === 'on') {
    $time             = time();
    $todayDate        = date('m/d', $time);
    $db               = Typecho_Db::get();
    $prefix           = $db->getPrefix();
    $sql              = "SELECT * FROM `{$prefix}contents` WHERE created < {$time} and FROM_UNIXTIME(created, '%m/%d') = '{$todayDate}' and type = 'post' and status = 'publish' and (password is NULL or password = '') LIMIT 10";
    $result           = $db->query($sql);
    $historyTodaylist = [];
    if ($result instanceof Traversable) {
        foreach ($result as $item) {
            $item               = Typecho_Widget::widget('Widget_Abstract_Contents')->push($item);
            $historyTodaylist[] = array(
                "title"     => htmlspecialchars($item['title']),
                "permalink" => $item['permalink'],
                "date"      => $item['year'] . ' ' . $item['month'] . '/' . $item['day']
            );
        }
    }
}


require_once Controller::instance()->view->fetch();
